package fun.rockchen.controller;

import fun.rockchen.anno.SystemControllerLog;
import fun.rockchen.anno.TokenValidate;
import fun.rockchen.service.interfaceService.TagService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import fun.rockchen.bean.Tag;


/**
 * @author Rock Chen
 * @Description:
 * @date 2023/10/16 10:24
 */

@SystemControllerLog(operation = "标签模块", type = "info")
@RequestMapping("/api/tag")
@RestController
public class TagController {
    private final TagService tagService;

    @Autowired
    public TagController(TagService tagService) {
        this.tagService = tagService;
    }

    @TokenValidate(operation = "--------token校验--------")
    @GetMapping
    public ResponseEntity<?> getTagList(@ModelAttribute Tag tag) {
        return tagService.getTagList(tag);
    }

    @TokenValidate(operation = "--------token校验--------")
    @DeleteMapping
    public ResponseEntity<?> deleteTag(@RequestParam String tagId) {
        return tagService.deleteTag(tagId);
    }
}
